using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SunshineFarmWord
{
    public class CropsBaseScripts : InteractiveBase
    {
        [field: SerializeField, Header("农作物节点")]
        private GameObject cropsBaseNode;

        private bool _seedUiShow = false;
        protected void Awake()
        {
        }
        protected override void Start()
        {
        }

        protected override void Update()
        {
        }

        protected void OnDestroy()
        {
        }

        public override void InteractiveStart(PlayerStateMachine stateMachine)
        {
            base.InteractiveStart(stateMachine);
            if (_seedUiShow) return;
            _seedUiShow = true;
            //注册取消事件
            SystemObserverManage.Instance.InvokeEvent(GameObjEnumClass.EventNotifyEnum.DeselectSeeds, CancelSeeds);
            //注册种植事件
            SystemObserverManage.Instance.InvokeEvent(GameObjEnumClass.EventNotifyEnum.SowSeeds, StartPlanting);

            // 执行选择种子
            //展示UI
            SystemObserverManage.Instance.CallEventNoArgs(GameObjEnumClass.EventNotifyEnum.SelectSeeds, stateMachine);
        }

        public void CancelSeeds(object _)
        {
            _seedUiShow = false;
            //取消注册的事件
            SystemObserverManage.Instance.RemoveEvent(GameObjEnumClass.EventNotifyEnum.DeselectSeeds, CancelSeeds);
            SystemObserverManage.Instance.RemoveEvent(GameObjEnumClass.EventNotifyEnum.SowSeeds, StartPlanting);
        }

        //种植
        public void StartPlanting(object _)
        {
        }

    }
}
